home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0195.lzh / AMOSLIST / text0087.txt < prev    next >
Encoding:
Text File  |  1995-02-01  |  2.5 KB  |  105 lines

  1.  
  2. On Wed, 11 Jan 1995 clayton@pms505.pms.ford.com wrote:
  3.  
  4. [...]
  5. >   Is there a patch/extension (or whatever) which allows the reading of a mouse
  6. >   from the other port?  Perhaps a call like USE_MOUSE_PORT(1) to 
  7. >   set up the condition, and a call like USE_MOUSE_PORT(0) to set the system
  8. >   back to default.  
  9.     I think there might be but I am not too sure.. 
  10.  
  11. >   I am not asking for both mice to be read simultaneously
  12. >   (although that capability would be very nice for other applications), 
  13. >   just the ability to read EITHER mouse 0 or mouse 1.  
  14. >   DOES THAT FUNCTIONALITY EXIST in AMOS?  
  15.  
  16.     No...
  17.  
  18. > Or is it a major oversight??
  19.  
  20.     Most of Amos is...
  21.  
  22. >   It would make many programs much nicer.  And the AMIGA hardware supports it.
  23.     
  24.     Here is some C code to do it... you can convert to Amos if you like..
  25.  
  26. #include <intuition/intuition.h>
  27. #include <clib/exec_protos.h>  /* Wait() Message stuuf */
  28. #include <clib/dos_protos.h>
  29.  
  30. #include <exec/types.h>
  31. #include <hardware/custom.h>
  32. #include <hardware/cia.h>
  33.  
  34. #include "screen.h"  /* needed for M_GetCurrWindow() */
  35. #include "input.h"
  36.  
  37. /* This will automatically be linked to the Custom structure: */
  38. extern struct Custom far custom;
  39.  
  40. /* This will automatically be linked to the CIA A (8520) chip: */
  41. extern struct CIA far ciaa;
  42.  
  43.  
  44.  
  45. UBYTE M_GetMousePort(UBYTE port)
  46. {
  47.   UBYTE data = 0;
  48.   UWORD joy, pot;
  49.  
  50.   custom.potgo = 0xFF00;
  51.   pot = custom.potinp;
  52.  
  53.   if( port == 1 )
  54.   {
  55.     /* PORT 1 "MOUSE PORT" */
  56.     joy = custom.joy0dat;
  57.     data += !( ciaa.ciapra & 0x0040 ) ? LEFT_BUTTON : 0;
  58.     data += !( pot & 0x0100 ) ? MIDDLE_BUTTON : 0;
  59.     data += !( pot & 0x0400 ) ? RIGHT_BUTTON : 0;
  60.   }
  61.   else
  62.   {
  63.     /* PORT 2 "JOYSTICK PORT" */ 
  64.     joy = custom.joy1dat;
  65.     data += !( ciaa.ciapra & 0x0080 ) ? LEFT_BUTTON : 0;
  66.     data += !( pot & 0x1000 ) ? MIDDLE_BUTTON : 0;
  67.     data += !( pot & 0x4000 ) ? RIGHT_BUTTON : 0;
  68.   }
  69.   return( data );
  70. }
  71.  
  72. /* Here are some Defines To Help Use these Function */
  73.     #define LEFT_BUTTON   1
  74.     #define MIDDLE_BUTTON 2
  75.     #define RIGHT_BUTTON  4
  76.     #define M_LMB2_Pressed()      ((M_GetMousePort(PORT2))&LEFT_BUTTON)
  77.     #define M_RMB2_Pressed()      ((M_GetMousePort(PORT2))&RIGHT_BUTTON)
  78.     #define M_MMB2_Pressed()      ((M_GetMousePort(PORT2))&MIDDLE_BUTTON)
  79.  
  80.  
  81.  
  82.     I hope this helps...
  83.  
  84.  
  85.                             mike
  86.  
  87.  
  88.  
  89. >   Thanks.
  90. >  +-----------------------------+
  91. >  | clayton@pms505.pms.ford.com |
  92. >  |    // an AMIGA programmer!  |
  93. >  |   // (the only intelligent  |
  94. >  | \X/   choice)   -- PEACE -- |
  95. >  +-----------------------------+
  96.  
  97.